﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using DWF.Studio.ScriptEngine.Event;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DWF.Studio.ScriptEngine
{
    /// <summary>
    /// 脚本引擎接口
    /// </summary>
    public interface IScriptEngine : IDisposable
    {
        /// <summary>
        /// 引擎id
        /// </summary>
        string Id
        {
            get;
        }

        /// <summary>
        /// 执行结果
        /// </summary>
        Object ExcuteResult
        {
            get;
        }

        /// <summary>
        /// 执行脚本
        /// </summary>
        /// <param name="projectDirectory"></param>
        /// <param name="scriptPath"></param>
        void ExecuteScript(string projectDirectory, string scriptPath);

        /// <summary>
        /// 执行脚本
        /// </summary>
        /// <param name="projectDirectory"></param>
        /// <param name="scriptPath"></param>
        /// <param name="param"></param>
        void ExecuteScript(string projectDirectory, string scriptPath, Dictionary<string, object> param);

        /// <summary>
        /// 调试脚本
        /// </summary>
        /// <param name="projectDirectory"></param>
        /// <param name="scriptPath"></param>
        void DebugScript(string projectDirectory, string scriptPath);

        /// <summary>
        /// 调试脚本
        /// </summary>
        /// <param name="projectDirectory"></param>
        /// <param name="scriptPath"></param>
        /// <param name="param"></param>
        void DebugScript(string projectDirectory, string scriptPath, Dictionary<string, object> param);

        /// <summary>
        /// 恢复调试
        /// </summary>
        void DebugResume();

        /// <summary>
        /// 调试进入
        /// </summary>
        void DebugStepInto();

        /// <summary>
        /// 调试跳出
        /// </summary>
        void DebugStepOut();

        /// <summary>
        /// 调试跨步
        /// </summary>
        void DebugStepOver();

        /// <summary>
        /// 调用调试信息
        /// </summary>
        void CallFrameInfo();

        /// <summary>
        /// 取消
        /// </summary>
        void Cancel();

        /// <summary>
        /// 执行中止
        /// </summary>
        Action<ExecuteAbortedEventArgs> ExecuteAborted { set; get; }

        /// <summary>
        /// 执行完成
        /// </summary>
        Action<ExecuteCompletedEventArgs> ExecuteCompleted { set; get; }

        /// <summary>
        /// 执行中，未处理异常
        /// </summary>
        Action<ExecuteUnhandledExceptionEventArgs> ExecuteOnUnhandledException { set; get; }

        /// <summary>
        /// 执行输出
        /// </summary>
        Action<char> ExcuteOutput { set; get; }

        /// <summary>
        /// 执行追踪信息
        /// </summary>
        Action<ExecuteTrackEventArgs> ExecuteTrack { set; get; }

        /// <summary>
        /// 调试追踪信息
        /// </summary>
        Action<DebugTrackEventArgs> DebugTrack { set; get; }

        /// <summary>
        /// 命中断点信息
        /// </summary>
        Action<HitBreakpointEventArgs> HitBreakpoint { set; get; }

        /// <summary>
        /// 执行开始
        /// </summary>
        Action<EventArgs> ExecuteStart { set; get; }

        /// <summary>
        /// 执行结束
        /// </summary>
        Action<EventArgs> ExecuteEnd { set; get; }
    }
}
